"""
下载需求----------------------必填参数-------------------------------
1.1：门店健康度汇总             path, startTime, endTime
1.2：门店健康度明细             path, startTime, endTime
1.3：门店健康度汇总+明细         path, startTime, endTime
下载需求----------------------必填参数-------------------------------
2.0：全部事件工单               无
2.1：售后部门主要KPI            path, startTime, endTime, members
2.2：8-21时段洗车单量           path, startTime, endTime
下载需求----------------------必填参数-------------------------------
3：运维工单明细                 path, startTime, endTime
"""
import datetime

demand = 3
# 下载路径 D:\Download\python丽莎
path = r'D:\Download\python丽莎'
# 开始日期（包含）
startTime = '2021-01-01'
# 结束日期（不包含）
endTime = '2022-10-28'
# 计算售后KPI员工
members = ['雷帅', '姜鹏军', '于阳']


if demand == 1.1:
    from health.factoryHealthQuery import factoryHealthQuery
    factoryHealthQuery(path, startTime, endTime)

elif demand == 1.2:
    from health.healthDetailExport import healthDetailExport
    healthDetailExport(path, startTime, endTime)

elif demand == 1.3:
    from health.factoryHealthQuery import factoryHealthQuery
    from health.healthDetailExport import healthDetailExport
    factoryHealthQuery(path, startTime, endTime)
    healthDetailExport(path, startTime, endTime)

elif demand == 2.0:
    from KPI_event.KPI import event_order
    dt = str(datetime.date.today())
    df = event_order()
    df.to_excel(f'{path}\事件工单{dt}.xlsx')

elif demand == 2.1:
    from KPI_event.KPI import kpi
    kpi(path, startTime, endTime, members)

elif demand == 2.2:
    from KPI_event.day_time_order_count import day_time_order_count
    day_time_order_count(path, startTime, endTime)

elif demand == 3:
    from other.work_order import work_order
    work_order(path, startTime, endTime)
elif demand == 4:
    import pandas as pd
    from KPI_event import operate_rate
    sts = pd.date_range('2021-04-01', '2022-03-01', freq='MS')
    ets = pd.date_range('2021-05-01', '2022-04-01', freq='MS')
    for st, et in zip(sts, ets):
        startTime = str(st)[:10]
        endTime = str(et)[:10]
        operate_rate.oprate_rate_total(startTime, endTime)
